<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>Closes a database connection</title>

 </head>
 <body><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="function.db2-client-info.html">db2_client_info</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="function.db2-column-privileges.html">db2_column_privileges</a></div>
 <div class="up"><a href="ref.ibm-db2.html">IBM DB2 函数</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div><hr /><div id="function.db2-close" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">db2_close</h1>
  <p class="verinfo">(PECL ibm_db2 &gt;= 1.0.0)</p><p class="refpurpose"><span class="refname">db2_close</span> &mdash; <span class="dc-title">
   Closes a database connection
  </span></p>

 </div>
 <div class="refsect1 description" id="refsect1-function.db2-close-description">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description">
   <span class="type">bool</span> <span class="methodname"><strong>db2_close</strong></span>
    ( <span class="methodparam"><span class="type">resource</span> <code class="parameter">$connection</code></span>
   )</div>


  <p class="para rdfs-comment">
   This function closes a DB2 client connection created with
   <span class="function"><a href="function.db2-connect.html" class="function">db2_connect()</a></span> and returns the corresponding
   resources to the database server.
  </p>
  <p class="para">
   If you attempt to close a persistent DB2 client connection created with
   <span class="function"><a href="function.db2-pconnect.html" class="function">db2_pconnect()</a></span>, the close request is ignored and the
   persistent DB2 client connection remains available for the next caller.
  </p>

 </div>

 <div class="refsect1 parameters" id="refsect1-function.db2-close-parameters">
  <h3 class="title">参数</h3>
  <p class="para">
   <dl>

    
     <dt>
<em><code class="parameter">connection</code></em></dt>

      <dd>

       <p class="para">
        Specifies an active DB2 client connection.
       </p>
      </dd>

     
   </dl>

  </p>
 </div>

 <div class="refsect1 returnvalues" id="refsect1-function.db2-close-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para">
   成功时返回 <strong><code>TRUE</code></strong>， 或者在失败时返回 <strong><code>FALSE</code></strong>。
  </p>
 </div>


 <div class="refsect1 examples" id="refsect1-function.db2-close-examples">
  <h3 class="title">范例</h3>
  <p class="para">
   <div class="example" id="example-1118">
    <p><strong>Example #1 Closing a connection</strong></p>
    <div class="example-contents"><p>
     The following example demonstrates a successful attempt to close a 
     connection to an IBM DB2, Cloudscape, or Apache Derby database.
    </p></div>
    <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br />$conn&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">db2_connect</span><span style="color: #007700">(</span><span style="color: #DD0000">'SAMPLE'</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'db2inst1'</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'ibmdb2'</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$rc&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">db2_close</span><span style="color: #007700">(</span><span style="color: #0000BB">$conn</span><span style="color: #007700">);<br />if&nbsp;(</span><span style="color: #0000BB">$rc</span><span style="color: #007700">)&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;</span><span style="color: #DD0000">"Connection&nbsp;was&nbsp;successfully&nbsp;closed."</span><span style="color: #007700">;<br />}<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</code></div>
    </div>

    <div class="example-contents"><p>以上例程会输出：</p></div>
    <div class="example-contents screen">
<div class="cdata"><pre>
Connection was successfully closed.
</pre></div>
    </div>
   </div>
  </p>
 </div>


 <div class="refsect1 seealso" id="refsect1-function.db2-close-seealso">
  <h3 class="title">参见</h3>
  <p class="para">
   <ul class="simplelist">
    <li class="member"><span class="function"><a href="function.db2-connect.html" class="function" rel="rdfs-seeAlso">db2_connect()</a> - Returns a connection to a database</span></li>
    <li class="member"><span class="function"><a href="function.db2-pclose.html" class="function" rel="rdfs-seeAlso">db2_pclose()</a> - Closes a persistent database connection</span></li>
    <li class="member"><span class="function"><a href="function.db2-pconnect.html" class="function" rel="rdfs-seeAlso">db2_pconnect()</a> - Returns a persistent connection to a database</span></li>
   </ul>
  </p>
 </div>


</div><hr /><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="function.db2-client-info.html">db2_client_info</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="function.db2-column-privileges.html">db2_column_privileges</a></div>
 <div class="up"><a href="ref.ibm-db2.html">IBM DB2 函数</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div></body></html>
